require(['./config'],()=>{
    require(['template','header','footer','unslider'],(template)=>{
        class Index{
            constructor(){
                this.getGoods()
                this.getNav()
                this.getGoods2()
                this.unslider()

            }
            getGoods(){
              $.get("/libs/json/index-json/home-goods.json",resp=>{
                  var html = template("home-template", {
                    list: resp
                })
                $("#home-list").html(html);
              })
            }
            getNav(){
                $.get("/libs/json/index-json/home-nav.json",resp=>{
                    var nav_html = template("nav-template", {
                      nav: resp
                  })
                  $("#nav-list").html(nav_html);
                })

            }
            getGoods2(){
                $.get("/libs/json/index-json/home-goods2.json",resp=>{
                    var goods_html = template("goods2-template", {
                      goods: resp
                  })
                  $("#goods2-list").html(goods_html);
                })
            }
            unslider(){
                var unslider = $('#div1').unslider({
                    speed: 1000,
                    delay: 2000,
                    dots: true
                  })
                  var data = unslider.data('unslider');
                
                    
                
                    $('.unslider-arrow04').click(function() {
                
                        var fn = this.className.split(' ')[1];
                
                        data[fn]();
                
                    });

            }

        }
        return  new Index()

    })
})